import {getExpressList} from "@/api/order";
import {getCompanyCache} from "@/views/order/modules/express";

export default {
  computed:{
    expressGroupOptions(){
      const options = [
        {
          label: '常用',
          options: []
        },
        {
          label: '其他',
          options: [],
        }
      ];
      this.expressCompanyList.forEach(item=>{
        if(item.hot){
          options[0].options.push(item)
        }else{
          options[1].options.push(item)
        }
      })
      if(options[0].options.length === 0){
        options[1].label = ''
      }
      return options;
    }
  },
  data(){
    return {
      expressCompanyList : [],
    };
  },
  mounted() {
    this.getCompanyList()
  },
  methods:{
    getCompanyList(){
      getCompanyCache().then(res=>{
        this.expressCompanyList = res
      })
    },
  }

}
